Skip to content

Conversation

@vdusek
Copy link
Contributor

@vdusek vdusek commented Jan 20, 2026

Issue

Description

  • Add Redocly and Spectral for OpenAPI lint checks.
    • Maybe using only Redocly is enough? Let me know your opinion.
    • Fixed 62 Spectral validation errors (missing required fields, incorrect types, nullable issues).
    • In Redocly, we have the errors set as warnings, I will resolve them in chore(openapi): Update to Open API v3.1.2 #2188.
  • Add YAML style lint check.
    • Only for the OpenAPI definitions.
    • Unify and enforce style.
    • Double quotes as in JSON or single quotes as we prefer in Py and AFAIK in JS as well, any opinion? 🙂
  • Remove Go API client generation job, as discussed in chore(openapi): Update to Open API v3.1.2 #2188.
    • It is replaced with the validate step, where we validate the bundled specification with the Redocly and check its size.
  • The new OpenAPI CI is: lint-check -> build -> validate.

Testing

  • CI passes

Note

Strengthens OpenAPI quality checks and streamlines CI.

  • Adds OpenAPI checks workflow (.github/workflows/openapi-ci.yaml) with Redocly/Spectral/YAML linting, bundle build/upload, and post-build validation (including bundle size check)
  • Removes legacy workflow (.github/workflows/openapi.yaml) and Go client codegen config (codegen/oapi-codegen-go/*), and cleans .gitignore
  • Introduces Spectral config (.spectral.yaml) with rule overrides and adds YAML linting via ESLint (eslint.config.mjs) scoped to apify-api/**, with an exception for openapi/openapi.yaml
  • Normalizes and fixes many OpenAPI YAML files (schemas, paths, components): consistent quoting/arrays, corrected $ref paths, examples, required lists, and descriptions

Written by Cursor Bugbot for commit b09198c. Configure here.

@vdusek vdusek added this to the 132nd sprint - Tooling team milestone Jan 20, 2026
@vdusek vdusek self-assigned this Jan 20, 2026
@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Jan 20, 2026
@apify-service-account
Copy link

Preview for this PR was built for commit b09198cc and is ready at https://pr-2190.preview.docs.apify.com!

@vdusek vdusek added the adhoc Ad-hoc unplanned task added during the sprint. label Jan 20, 2026
@apify-service-account
Copy link

Preview for this PR was built for commit 697ec440 and is ready at https://pr-2190.preview.docs.apify.com!

@apify-service-account
Copy link

Preview for this PR was built for commit 26e8706a and is ready at https://pr-2190.preview.docs.apify.com!

@apify-service-account
Copy link

Preview for this PR was built for commit 63228a82 and is ready at https://pr-2190.preview.docs.apify.com!

@apify-service-account
Copy link

Preview for this PR was built for commit 80e67ec3 and is ready at https://pr-2190.preview.docs.apify.com!

@janbuchar
Copy link
Contributor

  • Maybe using only Redocly is enough? Let me know your opinion.

I don't know, if Spectral doesn't take too much time, we can keep both 🤷

  • Fixed 62 Spectral validation errors (missing required fields, incorrect types, nullable issues).

Looks like it's doing useful work then - unless it's the same as what Redocly reports

  • Double quotes as in JSON or single quotes as we prefer in Py and AFAIK in JS as well, any opinion? 🙂

They are optional in most cases anyway, so no strong feelings. Which quotes produce the smaller diff in this PR?

cc @bliuchak as he added the original validation step.

@fnesveda
Copy link
Member

Double quotes as in JSON or single quotes as we prefer in Py and AFAIK in JS as well, any opinion? 🙂

They are optional in most cases anyway, so no strong feelings. Which quotes produce the smaller diff in this PR?

I have a slight preference towards double quotes, but I don't really care. I would see if there are more strings that need escaping single quotes or double quotes, and choose based on that.

But whichever we choose, can we enforce them everywhere?

I'd rather have it consistent than have to think "why are there quotes here but not here?"
Also, if a string doesn't have quotes, and then you change it so that it requires them (either by adding a word like "shouldn't" or some phrase in quotes), it will make for a slightly messier diff.

Copy link
Contributor

@janbuchar janbuchar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No way I'm gonna review all the changes, so I'm going to trust you 😁

package.json Outdated
"redoc:build:clean": "npm run redoc:build:clean:yaml && npm run redoc:build:clean:json",
"redoc:build:clean:yaml": "redocly bundle apify-api/openapi/openapi.yaml --skip-decorator=apify/legacy-doc-url-decorator --skip-decorator=apify/client-references-links-decorator --skip-decorator=apify/code-samples-decorator -o static/api/openapi.yaml",
"redoc:build:clean:json": "redocly bundle apify-api/openapi/openapi.yaml --skip-decorator=apify/legacy-doc-url-decorator --skip-decorator=apify/client-references-links-decorator --skip-decorator=apify/code-samples-decorator -o static/api/openapi.json",
"openapi:build": "npm run redoc:build:clean",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like there are way too many package scripts now. Can we perhaps remove some of the older, redoc-prefixed ones? 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I didn't want to break commands people are already used to, but OK 😬.

All OpenAPI-related npm scripts are now grouped under the "openapi" prefix. Why? Because the workflow is no longer using only Redoc (it also uses Astral and ESLint for some commands).

Script mapping

  • redoc:start -> openapi:preview
  • redoc:build -> openapi:bundle
  • redoc:build:clean -> openapi:build
  • redoc:build:clean:yaml -> openapi:build:yaml
  • redoc:build:clean:json -> openapi:build:json

Removed scripts

  • redoc:test - This was just redocly lint && redoc:build and was only used in CI, where it has been updated.
  • redoc:test2 - This referenced a non-existent bin/schemathesis script and was not used anywhere.

@vdusek
Copy link
Contributor Author

vdusek commented Jan 21, 2026

I have a slight preference towards double quotes, but I don't really care. I would see if there are more strings that need escaping single quotes or double quotes, and choose based on that.

If double quotes are configured but the string itself contains double quotes, for example 'He said, "Crawlee is the best"', the linter won't complain. It prefers switching to the other quote style rather than escaping. The same applies vice versa.

And it enforces the use of quotes only where they are actually necessary.

But whichever we choose, can we enforce them everywhere?

You mean everywhere in this repository?

Also, if a string doesn't have quotes, and then you change it so that it requires them (either by adding a word like "shouldn't" or some phrase in quotes) it will make for a slightly messier diff.

AFAIK this is not an example where YAML would require quotes - quoting is only necessary in cases where the value would otherwise be interpreted as a different type, for example "42", "3.14", "{hello: world}", ...

So taking this together with the fact that it enforces the use of quotes only where they are necessary, this should be OK.

@fnesveda
Copy link
Member

Ah, thanks for the explanation, I thought it works differently 🤦 In that case I also don't care very much, whichever you prefer.

- All OpenAPI-related npm scripts are now grouped under the "openapi" prefix, as the workflow is no longer using Redoc only (it also uses Spectral and ESLint for some commands).

Script mapping
- redoc:start -> openapi:preview
- redoc:build -> openapi:bundle
- redoc:build:clean -> openapi:build
- redoc:build:clean:yaml -> openapi:build:yaml
- redoc:build:clean:json -> openapi:build:json

Removed scripts
- redoc:test - This was just `redocly lint && redoc:build` and was only used in CI, where it has been updated.
- redoc:test2 - This referenced a non-existent `bin/schemathesis` script and was not used anywhere.
Copy link
Member

@fnesveda fnesveda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't checked the whole thing, just the important parts, and looks good 👍

@apify-service-account
Copy link

Preview for this PR was built for commit d302e0c8 and is ready at https://pr-2190.preview.docs.apify.com!

@vdusek vdusek merged commit f1d9dee into master Jan 21, 2026
12 checks passed
@vdusek vdusek deleted the add-api-spec-lint branch January 21, 2026 09:36
@vdusek
Copy link
Contributor Author

vdusek commented Jan 21, 2026

I'm merging this to unblock #2188 and related work there.

@bliuchak If you would find the new validation step not robust enough, we can try to come up with a better solution in a follow-up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants